------------------------------------------------------------------------
-- @brief UI入口
------------------------------------------------------------------------
require("Common.functions")
require("Common.json")
require("Common.api")

------------------------------------------------------------------------
-- @brief LuaJit 
local function LuaInit()
   -- collectgarbage("setpause", 100)
   -- collectgarbage("setstepmul", 5000)
    if jit ~= nil then
        jit.off()
        jit.flush()
    end
end
------------------------------------------------------------------------
-- @brief LuaPanda 断点调试使用VSCode软件装上LuaHelp插件可以断点调用
-- 使用断点调试后会生成一个launch.json的文件替换成下面配置
-- {
--     // Use IntelliSense to learn about possible attributes.
--     // Hover to view descriptions of existing attributes.
--     // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
--     "version": "0.2.0",
--     "configurations": [
--         {
--             "type": "LuaHelper-Debug",
--             "request": "launch",
--             "name": "LuaHelper-Attach",
--             "description": "通用模式,通常调试项目请选择此模式",
--             "cwd": "${workspaceFolder}",
--             "luaFileExtension": "lua",
--             "connectionPort": 8818,
--             "stopOnEntry": false,
--             "useCHook": false,
--             "autoPathMode": true
--         }
--     ]
-- }
local function ConnectDebugger()
    if api.DeviceInfo:IsEditor() then
        require("Debugger.LuaPanda").start("127.0.0.1", 8818)
    end
end


local P = class("LayerMain")
------------------------------------------------------------------------
-- @brief 唤醒
function P:Awake()
	LuaInit()
	ConnectDebugger()
	api.UIPackage.AddPackage("UI/Main")
end
------------------------------------------------------------------------
-- @brief 开始
function P:Start()
	local mainView = self.gameObject:GetComponent("UIPanel").ui
    local LayerManager = require("UI.LayerManager")
	LayerManager.instance():Init(self._mainView)
end
------------------------------------------------------------------------
-- @brief 物理更新
function P:FixedUpdate()
end
------------------------------------------------------------------------
-- @brief 更新
function P:Update()
end
------------------------------------------------------------------------
-- @brief 物理更新
function P:UpdateLate()
end
------------------------------------------------------------------------
-- @brief 销毁
function P:OnDestroy()
end
------------------------------------------------------------------------
return P
